
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    diy_name:"律师平台",
    is_lawyer: false,
    is_lawyer_firm: false,
    is_merchant: false,
    set: {},
    member:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData();
  },
  getData(){
    let urlStr = app.getNetAddresss(
      "plugin.lawyer-platform.frontend.controllers.index.index");
    app._getNetWork({
      url:urlStr,
      success:(res)=>{
        if (res.data.result == 1) {
          let data = res.data.data
          this.setData({
              is_lawyer: data.is_lawyer,
              is_lawyer_firm: data.is_lawyer_firm,
              is_merchant: data.is_merchant,
              diy_name:"律师平台",
              member:data.member
          })
          wx.setNavigationBarTitle({
            title: data?data.set.diy_name : "律师平台"
          })
          }
        }
      })
    
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  to(e){
    let url = e.currentTarget.dataset.url,type=e.currentTarget.dataset.type;
    if(url == 'order'){
      wx.navigateTo({
        url: '/packageI/lawyerPlatform/order/order?order_type=member',
      })
    }
    if(url == 'message'){
      wx.navigateTo({
        url: '/packageI/lawyerPlatform/chat/chat?message_type=1',
      })
    }
    if(url == 'office' ){
      if(!this.data.is_lawyer_firm){
        wx.navigateTo({
          url: '/packageI/lawyerPlatform/info/info?type=office'
        })
      }else{
        wx.navigateTo({
          url: '/packageI/lawyerPlatform/manage/manage?type='+type,
        })

      }
    }
    if(url == "management"){
      if(!this.data.is_lawyer){
        wx.navigateTo({
          url: '/packageI/lawyerPlatform/info/info?type=lawyer'
        })
      }else{
        wx.navigateTo({
          url: '/packageI/lawyerPlatform/manage/manage?type='+type,
        })

      }
    }
    if(url == 'operators'){
      wx.navigateTo({
        url: '/packageI/lawyerPlatform/operators/operators',
      })
    }
    if(url == 'enterprise'){
      wx.navigateTo({
        url: '/packageI/lawyerPlatform/enterprise/enterprise',
      })
    }
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})